﻿<%@ Page Title="Thông tin cá nhân" Language="C#" MasterPageFile="~/Admin/AdminMTP.Master" AutoEventWireup="true" CodeBehind="Staff_Personal.aspx.cs" Inherits="SQT.tracnghiem.Admin.Staff_Personal" %>

<%@ Import Namespace="DataAccess" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link href="../Content/css/staffpersonal.css" rel="stylesheet" />
    <script src="../Ajax/JS/Personal.js"></script>
    <script src="../Scripts/tinymce/tinymce.min.js"></script>
    <script src="../Scripts/tinymce/plugins/furigana/plugin.min.js"></script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="user-wall-paper w3-row w3-display-container" style="background: url('/Content/wallpaper/<%=this.banner %>') no-repeat center; background-size: 100%">
        <div class="w3-col" style="width: 15%">
            <div onmouseover="$(this).children('div').removeClass('w3-hide');" onmouseout="$(this).children('div').addClass('w3-hide');" class="w3-display-container user-img-box">
                <img src="../Content/Avatar/<%=this.avatar %>" class="user-img" />
                <%if (this.id.ToString() == Session["admin_id"].ToString())
                    {%>
                <div style="cursor: pointer" onclick="document.getElementById('doiavatar').style.display = 'block'" class="w3-text-white w3-padding w3-hide w3-display-bottommiddle black-opacity-bg"><i class="fa fa-camera"></i>&nbsp;cập nhật ảnh đại diện</div>
                <%} %>
            </div>
        </div>
        <div class="w3-col l5 w3-text-white">
            <span class="w3-xlarge black-opacity-bg"><%=fullname %></span><br />
            <span class="w3-large black-opacity-bg"><%=email %></span><br />
            <span class="w3-large black-opacity-bg"><%=sex %>, <%=old %> tuổi, <%=address %></span>
        </div>
        <%if (this.id.ToString() == Session["admin_id"].ToString())
            {%>
        <div data-toggle="tooltip" data-placement="right" title="Ảnh bìa sẽ đẹp hơn với kích thước 1200 x 300 pixel" onclick="document.getElementById('doianhbia').style.display = 'block'" onmouseover="$(this).children('span').removeClass('w3-hide');$(this).addClass('black-opacity-bg')" onmouseout="$(this).children('span').addClass('w3-hide');$(this).removeClass('black-opacity-bg')" class="w3-text-white w3-display-topleft w3-padding" style="cursor: pointer"><i class="fa fa-camera"></i>&nbsp;<span class="w3-hide">Cập nhật ảnh bìa</span></div>
        <%} %>
    </div>
    <div class="w3-row">
        <ul id="user-option-tab" class="user-option-tab w3-navbar w3-white">
            <li class="w3-border-right"><a href="javascript:;" class="tablink w3-teal" onclick="openuser(event, 'ttcn');">Thông tin cá nhân</a></li>
            <%if (this.id.ToString() == Session["admin_id"].ToString())
                {%>
            <li class="w3-border-right"><a href="javascript:;" class="tablink" onclick="openuser(event, 'bmtk');">Bảo mật tài khoản</a></li>
            <%} %>
            <li class="w3-border-right"><a href="javascript:;" class="tablink" onclick="openuser(event, 'tkgl');">Thống kê giờ làm</a></li>
            <%if (captain == true && this.id.ToString() == Session["admin_id"].ToString())
                {%>
            <li class="w3-border-right"><a href="javascript:;" class="tablink" onclick="openuser(event, 'llv');">Lịch làm việc</a></li>
            <li class="w3-border-right"><a href="javascript:;" class="tablink" onclick="openuser(event, 'tb');">Thông báo</a></li>
            <%}%>
            <%if (check_role_menu())
                { %>
            <li class=""><a href="javascript:;" class="tablink" onclick="openuser(event, 'pq');">Phân quyền</a></li>
            <%} %>
        </ul>
        <div id="user-option-content">
            <!--Thông tin cá nhân-->
            <div id="ttcn" class="city w3-padding">
                <header class="w3-row w3-border-bottom w3-border-teal w3-padding w3-text-teal w3-margin-bottom">
                    <label>Thông tin cơ bản</label>
                </header>
                <div class="w3-row w3-padding">
                    <label class="w3-col l2">Họ tên</label>
                    <%if (this.id.ToString() == Session["admin_id"].ToString())
                        {%>
                    <input type="text" id="personal_fullname" value="<%=fullname %>" placeholder="Nhập họ tên của bạn" />
                    <%}
                        else
                        { %>
                    <label><%=fullname %></label>
                    <%} %>
                    <label class="w3-hide w3-text-red" id="error_mes_name"></label>
                </div>
                <div class="w3-row w3-padding">
                    <label class="w3-col l2">Giới tính</label>
                    <%if (this.id.ToString() == Session["admin_id"].ToString())
                        {%>
                    <div class="radio">
                        <%if (check_sex == true)
                            { %>
                        <input type="radio" name="user-sex" value="1" checked="checked" id="user-male" /><label for="user-male">Nam</label>&nbsp;
                        <input type="radio" name="user-sex" value="0" id="user-female" /><label for="user-female">Nữ</label>
                        <%}
                            else
                            { %>
                        <input type="radio" name="user-sex" value="1" id="user-male" /><label for="user-male">Nam</label>&nbsp;
                        <input type="radio" name="user-sex" value="0" checked="checked" id="user-female" /><label for="user-female">Nữ</label>
                        <%}%>
                    </div>
                    <%}
                        else
                        { %>
                    <label><%=sex %></label>
                    <%} %>
                </div>
                <div class="w3-row w3-padding">
                    <label class="w3-col l2">Sinh nhật</label>
                    <%if (this.id.ToString() == Session["admin_id"].ToString())
                        {%>
                    <div class="w3-col l1 w3-padding-right">
                        <select id="personal_day">
                            <option value="0" selected="selected">Ngày</option>
                            <%for (int i = 1; i <= 31; i++)
                                {
                                    if (i == this.day)
                                    {%>
                            <option selected="selected" value="<%=i %>"><%=i %></option>
                            <%}
                                else
                                { %>
                            <option value="<%=i %>"><%=i %></option>
                            <%} %>
                            <%} %>
                        </select>
                    </div>
                    <div class="w3-col l1 w3-padding-right">
                        <select id="personal_month">
                            <%for (int i = 1; i <= 12; i++)
                                {
                                    if (i == this.month)
                                    { %>
                            <option selected="selected" value="<%=i %>"><%=i %></option>
                            <%}
                                else
                                { %>
                            <option value="<%=i %>"><%=i %></option>
                            <%} %>
                            <%} %>
                        </select>
                    </div>
                    <div class="w3-col l1 w3-padding-right">
                        <select id="personal_year">
                            <option value="0" selected="selected">Năm</option>
                            <%
                                for (int i = get_year; i >= get_year - 40; i--)
                                {
                                    if (i == this.year)
                                    { %>
                            <option selected="selected" value="<%=i %>"><%=i %></option>
                            <%}
                                else
                                { %>
                            <option value="<%=i %>"><%=i %></option>
                            <%} %>
                            <%} %>
                        </select>
                    </div>
                    <%}
                        else
                        { %>
                    <label><%=day %>/<%=month %>/<%=year %></label>
                    <%} %>
                </div>

                <header class="w3-row w3-border-bottom w3-border-teal w3-padding w3-text-teal w3-margin-bottom">
                    <label>Thông tin liên hệ</label>
                </header>
                <div class="w3-row w3-padding">
                    <label class="w3-col l2">Email</label>
                    <%if (this.id.ToString() == Session["admin_id"].ToString())
                        {%>
                    <input id="personal_email" type="email" value="<%=email %>" placeholder="Nhập email của bạn" />
                    <%}
                        else
                        { %>
                    <label><%=email %></label>
                    <%} %>
                    <label class="w3-hide w3-text-red" id="error_mes_email"></label>
                </div>
                <div class="w3-row w3-padding">
                    <label class="w3-col l2">Số điện thoại</label>
                    <%if (this.id.ToString() == Session["admin_id"].ToString())
                        {%>
                    <input id="personal_phone" type="text" value="<%=phone %>" placeholder="Nhập số điện thoại của bạn" />
                    <%}
                        else
                        { %>
                    <label><%=phone %></label>
                    <%} %>
                </div>
                <%var get_province = (from p in new TblProvinceController().FetchAll() orderby p.ProvinceName ascending select p);
                %>
                <div class="w3-row w3-padding">
                    <label class="w3-col l2">Địa chỉ</label>
                    <%if (this.id.ToString() == Session["admin_id"].ToString())
                        {%>
                    <div class="w3-col l2 w3-padding-right">
                        <select id="personal_province">
                            <%if (this.province == null)
                                {
                            %>
                            <option selected="selected" value="0">Tỉnh</option>
                            <%
                                foreach (TblProvince province in get_province)
                                {
                            %>
                            <option value="<%=province.Id%>"><%=province.ProvinceName%></option>
                            <%}
                                }
                                else
                                {
                                    foreach (TblProvince province in get_province)
                                    {
                                        if (province.Id == this.province)
                                        {
                            %>
                            <option selected="selected" value="<%=province.Id%>"><%=province.ProvinceName%></option>
                            <%}
                                else
                                { %>
                            <option value="<%=province.Id%>"><%=province.ProvinceName%></option>
                            <%} %>

                            <%}
                                } %>
                        </select>
                    </div>
                    <div class="w3-col l2 w3-padding-right">
                        <select id="personal_city">
                            <%
                                if (this.city != null)
                                {
                                    foreach (TblCity city in (from p in new TblCityController().FetchAll().Where(x => x.ProvinceId == this.province) orderby p.CityName descending select p))
                                    {
                                        if (city.Id == this.city)
                                        {
                            %>
                            <option selected="selected" value="<%=city.Id%>"><%=city.CityName%></option>
                            <%}
                                else
                                { %>
                            <option value="<%=city.Id%>"><%=city.CityName%></option>
                            <%} %>

                            <%}
                                } %>
                        </select>
                    </div>
                    <%}
                        else
                        { %>
                    <label><%=address %></label>
                    <%} %>
                </div>
                <%if (this.id.ToString() == Session["admin_id"].ToString())
                    {%>
                <div class="w3-row w3-padding w3-margin-top">
                    <a id="btn_edit_info_staff" class="w3-btn w3-teal"><i class="fa fa-edit"></i>&nbsp;Lưu thay đổi</a>
                </div>
                <%} %>
            </div>
            <%if (this.id.ToString() == Session["admin_id"].ToString())
                {%>
            <%--Bảo mật tài khoản--%>
            <div id="bmtk" style="display: none" class="city w3-padding">
                <header class="w3-row w3-border-bottom w3-border-teal w3-padding w3-text-teal w3-margin-bottom">
                    <label>Thay đổi mật khẩu</label>
                </header>
                <div id="change_pass">
                    <div class="w3-row">
                        <p id="messenge_pass" class="w3-text-red"></p>
                    </div>
                    <div class="w3-row w3-padding">
                        <label class="w3-col l2">Mật khẩu hiện tại</label>
                        <input id="txt_oldpass" type="password" placeholder="Nhập mật khẩu hiện tại" />
                    </div>
                    <div class="w3-row w3-padding">
                        <label class="w3-col l2">Mật khẩu mới</label>
                        <input id="txt_newpass" type="password" placeholder="Nhập mật khẩu mới" />
                    </div>
                    <div class="w3-row w3-padding">
                        <label class="w3-col l2">Nhập lại mật khẩu mới</label>
                        <input id="txt_repass" type="password" placeholder="Nhập lại mật khẩu mới" />
                    </div>
                </div>
                <div class="w3-row w3-padding">
                    <a id="btn_change_pass" class="w3-btn w3-teal"><i class="fa fa-check"></i>&nbsp;Xác nhận</a>
                </div>
            </div>
            <%} %>
            <%--Thống kê giờ làm --%>
            <div id="tkgl" class="city" style="display: none">
                <div class="w3-row w3-padding">
                    <div class="w3-col" style="width: 120px">
                        <label class="w3-text-teal">Tháng </label>
                        <select id="hour-month" class="w3-border w3-border-teal">
                            <%for (int i = 1; i <= 12; i++)
                                {
                                    if (i == DateTime.Now.Month)
                                    {
                            %>
                            <option selected="selected" value="<%=i %>"><%=i %></option>
                            <%
                                }
                                else
                                {
                            %>
                            <option value="<%=i %>"><%=i %></option>
                            <%} %>
                            <%} %>
                        </select>
                    </div>
                    <div class="w3-col" style="width: 130px">
                        <label class="w3-text-teal">Năm </label>
                        <select id="hour-year" class="w3-border w3-border-teal">
                            <%
                                int get_hour_year = DateTime.Now.Year;
                                for (int i = get_hour_year; i >= get_hour_year - 8; i--)
                                {
                                    if (i == DateTime.Now.Year)
                                    {
                            %>
                            <option selected="selected" value="<%=i %>"><%=i %></option>
                            <%
                                }
                                else
                                {
                            %>
                            <option value="<%=i %>"><%=i %></option>
                            <%}
                                }%>
                        </select>
                    </div>
                    <div id="id_staff" class="w3-hide"><%=this.id %></div>
                    <div class="w3-col l1">
                        <a id="btn_get_time" class="w3-btn w3-teal"><i class="fa fa-search"></i></a>
                    </div>
                </div>
                <div id="tbl_worked" class="w3-row">
                    <table class="w3-table w3-striped w3-white w3-bordered">
                        <thead>
                            <tr class="w3-teal">
                                <th>Ngày làm</th>
                                <th>Chi tiết giờ làm</th>
                                <th>Tổng số giờ</th>
                                <th>Xác nhận</th>
                            </tr>
                        </thead>
                        <tr>
                            <td>Tháng <%=DateTime.Now.Month %> Năm <%=DateTime.Now.Year %></td>
                            <td>&nbsp;</td>
                            <td><%=this.hour %> giờ <%=this.minute %> phút</td>
                            <td>&nbsp;</td>
                        </tr>

                        <%
                            var get_check_manager = new TblCheckManagerController().FetchAll().Where(x => x.ManagerId == id && DateTime.Parse(x.CheckIn.ToString()).Month == DateTime.Now.Month && DateTime.Parse(x.CheckIn.ToString()).Year == DateTime.Now.Year && x.CheckOut != null);
                            foreach (TblCheckManager chk in get_check_manager)
                            {
                                string chk_in = "";
                                string chk_out = "";
                                string date = "";
                                DateTime chk_in_date = DateTime.Parse(chk.CheckIn.ToString());
                                if (chk_in_date.Day < 10)
                                    date = "0" + chk_in_date.Day.ToString() + "/";
                                else
                                    date = chk_in_date.Day.ToString() + "/";

                                if (chk_in_date.Month < 10)
                                    date += "0" + chk_in_date.Month.ToString() + "/";
                                else
                                    date += chk_in_date.Month.ToString() + "/";

                                date += chk_in_date.Year.ToString();

                                if (DateTime.Parse(chk.CheckIn.ToString()).Hour < 10)
                                    chk_in = "0" + DateTime.Parse(chk.CheckIn.ToString()).Hour.ToString() + ":";
                                else
                                    chk_in = DateTime.Parse(chk.CheckIn.ToString()).Hour.ToString() + ":";

                                if (DateTime.Parse(chk.CheckIn.ToString()).Minute < 10)
                                    chk_in += "0" + DateTime.Parse(chk.CheckIn.ToString()).Minute.ToString();
                                else
                                    chk_in += DateTime.Parse(chk.CheckIn.ToString()).Minute.ToString();

                                if (DateTime.Parse(chk.CheckOut.ToString()).Hour < 10)
                                    chk_out = "0" + DateTime.Parse(chk.CheckOut.ToString()).Hour.ToString() + ":";
                                else
                                    chk_out = DateTime.Parse(chk.CheckOut.ToString()).Hour.ToString() + ":";

                                if (DateTime.Parse(chk.CheckOut.ToString()).Minute < 10)
                                    chk_out += "0" + DateTime.Parse(chk.CheckOut.ToString()).Minute.ToString();
                                else
                                    chk_out += DateTime.Parse(chk.CheckOut.ToString()).Minute.ToString();

                                var get_admin = new TblManagerController().FetchAll().Where(x => x.ManagerId == chk.ManagerId).Single();
                                string checkout = "";
                                int hour = 0, minute = 0;
                                if (chk.CheckOut != null)
                                {
                                    checkout = DateTime.Parse(chk.CheckOut.ToString()).Hour.ToString() + ":" + DateTime.Parse(chk.CheckOut.ToString()).Minute.ToString();
                                    if (DateTime.Parse(chk.CheckOut.ToString()).Hour >= DateTime.Parse(chk.CheckIn.ToString()).Hour)
                                    {
                                        hour = DateTime.Parse(chk.CheckOut.ToString()).Hour - DateTime.Parse(chk.CheckIn.ToString()).Hour;
                                    }
                                    else
                                    {
                                        hour = 24 - DateTime.Parse(chk.CheckIn.ToString()).Hour + DateTime.Parse(chk.CheckOut.ToString()).Hour;
                                    }

                                    if (DateTime.Parse(chk.CheckIn.ToString()).Minute <= DateTime.Parse(chk.CheckOut.ToString()).Minute)
                                    {
                                        minute = DateTime.Parse(chk.CheckOut.ToString()).Minute - DateTime.Parse(chk.CheckIn.ToString()).Minute;
                                    }
                                    else
                                    {
                                        minute = 60 - DateTime.Parse(chk.CheckIn.ToString()).Minute + DateTime.Parse(chk.CheckOut.ToString()).Minute;
                                        hour--;
                                    }
                                }
                        %>
                        <tr>
                            <td><%=date %></td>
                            <td><%=chk_in %> - <%=chk_out %></td>
                            <td><%=hour %> giờ <%=minute %> phút</td>
                            <%if (chk.Accept == true)
                                { %>
                            <td><span><i class="fa fa-check w3-text-teal" style="margin-right: 5px; font-size: 19px"></i></span></td>
                            <%}
                                else
                                { %>
                            <td>&nbsp;</td>
                            <%} %>
                        </tr>
                        <%} %>
                    </table>
                </div>
            </div>
            <%if (captain == true && this.id.ToString() == Session["admin_id"].ToString())
                {%>
            <!--Lịch làm việc-->
            <div id="llv" class="city" style="display: none">
                <div class="w3-row w3-padding">
                    <div class="w3-col" style="width: 11%">
                        <label class="w3-text-teal">Năm</label>
                        <select id="work-year" class="w3-border w3-border-teal">
                            <%
                                //int get_work_year = DateTime.Now.Year;
                                var get_work_year = (from p in new TblWeekController().FetchAll() orderby p.Year descending select p).ToList();

                                for (int i = 0; i < get_work_year.Count; i++)
                                {
                                    if (i > 0)
                                    {
                                        if (get_work_year[i].Year == get_work_year[i - 1].Year)
                                            continue;
                                    }
                            %>
                            <option value="<%=get_work_year[i].Year%>"><%=get_work_year[i].Year%></option>
                            <%} %>
                        </select>
                    </div>

                    <div class="w3-col" style="width: 10%">
                        <label class="w3-text-teal">Tuần</label>
                        <select id="work-week" class="w3-border w3-border-teal">
                            <%
                                var get_week = (from p in new TblWeekController().FetchAll() where p.Year == this.last_year orderby p.Week descending select p).ToList();
                                for (int i = 0; i < get_week.Count; i++)
                                { %>
                            <option value="<%=get_week[i].Id %>"><%=get_week[i].Week %></option>
                            <%} %>
                        </select>
                    </div>
                    <div class="w3-col l1">
                        <a id="btn_view_working" onclick="view_working()" class="w3-btn w3-teal"><i class="fa fa-search"></i></a>
                    </div>
                    <div class="w3-col l1">
                        <a onclick="document.getElementById('llvht').style.display = 'none';document.getElementById('llvm').style.display = 'block'" class="w3-btn w3-teal btn_add_working_form"><i class="fa fa-plus"></i>&nbsp;Thêm lịch làm việc</a>
                    </div>
                </div>
                <div id="llvht" class="w3-row w3-responsive w3-animate-left">
                    <div id="lichLamViec">
                        <table class="w3-table w3-white w3-bordered w3-centered w3-striped">
                            <thead>
                                <tr class="w3-teal">
                                    <th>Giáo viên</th>
                                    <th>Giờ làm</th>
                                    <%
                                        DateTime temp = DateTime.Parse(this.week_start.ToString());
                                    %>
                                    <th>Thứ 2 (<%=temp.Day %>/<%=temp.Month %>)</th>
                                    <%for (int i = 1; i < 7; i++)
                                        {%>

                                    <%
                                        if (temp.AddDays(i).DayOfWeek == DayOfWeek.Sunday)
                                        {%>
                                    <th>Chủ Nhật (<%=temp.AddDays(i).Day %>/<%=temp.AddDays(i).Month %>)</th>
                                    <%}
                                        else
                                        {
                                            int day = (int)temp.AddDays(i).DayOfWeek;%>
                                    <th>Thứ <%=day+=1 %> (<%=temp.AddDays(i).Day %>/<%=temp.AddDays(i).Month %>)</th>
                                    <%}
                                        }%>
                                </tr>
                            </thead>
                            <%
                                var get_staff = new TblManagerController().FetchAll().Where(x => x.Role == int.Parse(Session["admin_level"].ToString()) && x.Active == true);
                                foreach (TblManager staff in get_staff)
                                {
                                    var get_work = new TblWorkingController().FetchAll().Where(x => x.Manager == staff.ManagerId && x.Week == last_id).ToList();
                                    string time = "&nbsp;", mon = "&nbsp;", tue = "&nbsp;", thu = "&nbsp;", wed = "&nbsp;", fri = "&nbsp;", sat = "&nbsp;", sun = "&nbsp;";
                                    int row_id = 0;
                                    if (get_work.Count > 0)
                                    {
                                        if (!string.IsNullOrEmpty(get_work[0].Time))
                                            time = get_work[0].Time;
                                        if (!string.IsNullOrEmpty(get_work[0].Monday))
                                            mon = get_work[0].Monday;
                                        if (!string.IsNullOrEmpty(get_work[0].Tuesday))
                                            tue = get_work[0].Tuesday;
                                        if (!string.IsNullOrEmpty(get_work[0].Wednesday))
                                            wed = get_work[0].Wednesday;
                                        if (!string.IsNullOrEmpty(get_work[0].Friday))
                                            fri = get_work[0].Friday;
                                        if (!string.IsNullOrEmpty(get_work[0].Thursday))
                                            thu = get_work[0].Thursday;
                                        if (!string.IsNullOrEmpty(get_work[0].Saturday))
                                            sat = get_work[0].Saturday;
                                        if (!string.IsNullOrEmpty(get_work[0].Sunday))
                                            sun = get_work[0].Sunday;
                                        if (!string.IsNullOrEmpty(get_work[0].Id.ToString()))
                                            row_id = get_work[0].Id;
                                    }
                            %>
                            <tr class="row_work">
                                <td class="w3-hide row_id"><%=row_id %></td>
                                <td class="w3-hide manager_id"><%=staff.ManagerId %></td>
                                <td rowspan="5" class="w3-border-right">
                                    <img src="../Content/avatar/<%=staff.Avatar%>" style="width: 170px; height: 170px; margin-bottom: 5px" /><br />
                                    <label class="w3-row"><%=staff.FullName %></label>
                                </td>
                                <td class="work_time work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=time %>' /></td>
                                <td class="work_mon work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=mon %>' /></td>
                                <td class="work_tue work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=tue %>' /></td>
                                <td class="work_wed work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=wed %>' /></td>
                                <td class="work_thu work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=thu %>' /></td>
                                <td class="work_fri work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=fri %>' /></td>
                                <td class="work_sat work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=sat %>' /></td>
                                <td class="work_sun work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=sun %>' /></td>
                            </tr>

                            <%
                                for (int i = 1; i < 5; i++)
                                {
                                    string time1 = "&nbsp;", mon1 = "&nbsp;", tue1 = "&nbsp;", thu1 = "&nbsp;", wed1 = "&nbsp;", fri1 = "&nbsp;", sat1 = "&nbsp;", sun1 = "&nbsp;";
                                    int row_id1 = 0;
                                    if (get_work.Count > i)
                                    {
                                        if (!string.IsNullOrEmpty(get_work[i].Time))
                                            time1 = get_work[i].Time;
                                        if (!string.IsNullOrEmpty(get_work[i].Monday))
                                            mon1 = get_work[i].Monday;
                                        if (!string.IsNullOrEmpty(get_work[i].Tuesday))
                                            tue1 = get_work[i].Tuesday;
                                        if (!string.IsNullOrEmpty(get_work[i].Wednesday))
                                            wed1 = get_work[i].Wednesday;
                                        if (!string.IsNullOrEmpty(get_work[i].Friday))
                                            fri1 = get_work[i].Friday;
                                        if (!string.IsNullOrEmpty(get_work[i].Thursday))
                                            thu1 = get_work[i].Thursday;
                                        if (!string.IsNullOrEmpty(get_work[i].Saturday))
                                            sat1 = get_work[i].Saturday;
                                        if (!string.IsNullOrEmpty(get_work[i].Sunday))
                                            sun1 = get_work[i].Sunday;
                                        if (!string.IsNullOrEmpty(get_work[i].Id.ToString()))
                                            row_id1 = get_work[i].Id;
                                    }
                            %>
                            <tr class="row_work">
                                <td class="w3-hide manager_id"><%=staff.ManagerId %></td>
                                <td class="w3-hide row_id"><%=row_id1 %></td>
                                <td class="work_time work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=time1 %>' /></td>
                                <td class="work_mon work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=mon1 %>' /></td>
                                <td class="work_tue work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=tue1 %>' /></td>
                                <td class="work_wed work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=wed1 %>' /></td>
                                <td class="work_thu work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=thu1 %>' /></td>
                                <td class="work_fri work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=fri1 %>' /></td>
                                <td class="work_sat work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=sat1 %>' /></td>
                                <td class="work_sun work">
                                    <input class='edited' autofocus='autofocus' type='text' value='<%=sun1 %>' /></td>
                            </tr>
                            <%}%>

                            <%} %>
                        </table>
                    </div>

                    <div class="w3-row w3-padding w3-center">
                        <a class="w3-btn w3-teal btn_edited_work"><i class="fa fa-save"></i>&nbsp;Lưu chỉnh sửa</a>
                        <%--<a class="w3-btn w3-teal"><i class="fa fa-trash"></i>&nbsp;Xóa</a>--%>
                    </div>
                </div>

                <div id="llvm" class="w3-row w3-responsive w3-animate-right" style="display: none">
                    <div id="lichLamViecMoi">
                    </div>
                    <div class="w3-row w3-padding w3-center">
                        <a class="w3-btn w3-teal btn_add_working"><i class="fa fa-save"></i>&nbsp;Lưu</a>
                        <a onclick="document.getElementById('llvht').style.display = 'block';document.getElementById('llvm').style.display = 'none'" class="w3-btn w3-teal"><i class="fa fa-times"></i>&nbsp;Hủy</a>
                    </div>
                </div>
            </div>

            <!--Thông báo-->
            <div id="tb" class="city w3-row" style="display: none">
                <%var get_notification = from p in new TblNotificationController().FetchAll().Where(x => x.NotificationSender == int.Parse(Session["admin_id"].ToString()) && x.NotificationIsDelete == false) orderby p.NotificationDate descending select p; %>
                <div class="w3-third">
                    <header class="w3-padding w3-center"><b>Danh sách thông báo</b></header>
                    <div class="ps-notice-list w3-padding">
                        <ul id="ps-notice-list" class="w3-ul w3-white">
                            <%foreach (TblNotification noti in get_notification)
                                { %>
                            <li id="notification-<%=noti.NotificationId %>" value="<%=noti.NotificationId %>"><%=noti.NotificationTitle %></li>
                            <%} %>
                        </ul>
                    </div>
                    <div class="w3-padding-4 w3-center">
                        <a onclick="btn_create_notice()" class="create-notice-btn w3-btn w3-teal"><i class="fa fa-plus"></i>&nbsp;Thêm thông báo mới</a>
                    </div>
                </div>
                <div class="w3-twothird w3-border-left">
                    <div id="create-notice-form">
                        <header class="w3-padding w3-center"><b>Thông báo mới</b></header>
    <div class="w3-padding w3-row">
        <label class="w3-col l1">Tiêu đề</label><input class="txt_notice_title tb-text w3-col" type="text" placeholder="Nhập tiêu đề thông báo" />
    </div>
    <div class="w3-padding w3-row">
        <label class="w3-col l1">Nội dung</label><textarea id="txt_add_notice_content" class="w3-col"></textarea>
    </div>
    <div class="w3-padding w3-row">
        <label class="w3-col l1">Gửi đến</label>
        <ul class="ss-author-list ss-checkbox w3-col l10">
            <%
                var get_role = new TblManagerRoleController().FetchAll();
                foreach (TblManagerRole role in get_role)
                {
                    var get_manager = new TblManagerController().FetchAll().Where(x => x.Role == role.RoleId && x.Active == true);
                    if (get_manager.ToList().Count == 0)
                        continue;
            %>
            <li>
                <a class="ss-author-list-item">
                    <input class="ss-check-room" type="checkbox" id="add-notice-<%=role.RoleId %>" /><label for="add-notice-<%=role.RoleId %>" class="ss-check"></label><i onclick="ss_open_author_list(this)" class="ss-show-member-btn fa fa-caret-right w3-large"></i><i class="ss-author-icon fa fa-users"></i><label><%=role.RoleName %></label>
                </a>
                <ul class="ss-author-list ss-author-member-list">
                    <%foreach (TblManager manager in get_manager)
                        { %>
                    <li><a>
                        <input class="ss-check-member" value="<%=manager.ManagerId %>" type="checkbox" id="add-notice-manager-<%=manager.ManagerId %>" /><label for="add-notice-manager-<%=manager.ManagerId %>" class="ss-check"></label><i class="fa fa-user"></i><span><%=manager.FullName %></span></a></li>
                    <%} %>
                </ul>
            </li>
            <%} %>
        </ul>
    </div>
    <div class="w3-padding-8 w3-center">
        <a onclick="btn_add_notice()" class="w3-btn w3-teal"><i class="fa fa-send-o"></i>&nbsp;Gửi</a>
    </div>
                    </div>
                    <div id="edit-notice-form">
                    </div>
                </div>
            </div>
            <%} %>
            <%if (check_role_menu())
                { %>
            <!--Phân quyền-->
            <div id="pq" class="city w3-row" style="display: none">
                <div class="w3-third">
                    <header class="w3-padding w3-center"><b>Chức năng</b></header>
                    <div class="pq-option-list w3-padding">
                        <ul class="ss-author-list">
                            <%var get_menu = new TblAdminMenuController().FetchAll().Where(x => x.AmIsDelete == false && !String.IsNullOrEmpty(x.AmCaptain));
                                foreach (TblAdminMenu menu in get_menu)
                                {
                                    if (check_accept_menu(menu.AmCaptain))
                                    {
                                        var get_child = new TblAdminMenuController().FetchAll().Where(x => x.AmParentID == menu.AmId);
                            %>
                            <li>
                                <%if (get_child.ToList().Count != 0)
                                    { %>
                                <a class="ss-author-list-item">
                                    <i onclick="ss_open_author_list(this)" class="ss-show-member-btn fa fa-caret-right w3-large"></i><i class="ss-author-icon <%=menu.AmIcon %>"></i>
                                    <label><%=menu.AmName %></label>
                                </a>
                                <ul class="ss-author-list ss-author-member-list">
                                    <%foreach (TblAdminMenu child in get_child)
                                        {%>
                                    <li onclick=" open_manager_list(<%=child.AmId %>)"><a><i class="<%=child.AmIcon %>"></i><span><%=child.AmName %></span></a></li>
                                    <%} %>
                                </ul>
                                <%}
                                    else
                                    { %>
                                <a onclick="open_manager_list(<%=menu.AmId %>)" class="ss-author-list-item">
                                    <i class="ss-author-icon <%=menu.AmIcon %>"></i>
                                    <label><%=menu.AmName %></label>
                                </a>
                                <%} %>
                            </li>
                            <%}
                                } %>
                        </ul>
                    </div>
                </div>
                <div id="role_show_manager_area" class="pq-right-content w3-twothird w3-border-left">
                </div>
            </div>
            <%} %>
        </div>
    </div>
    <div id="doiavatar" class="w3-modal">
        <div class="w3-modal-content w3-center w3-animate-top w3-card-8 w3-white" style="width: 40%">
            <header class="w3-padding">
                <p class="w3-xlarge">Cập nhật ảnh đại diện</p>
            </header>
            <div class="w3-row w3-center">
                <input type="file" role="file" class="changewallpaper" name="fileUpload" id="fileUpload" />
                <label for="fileUpload" class="w3-btn w3-border w3-white"><i class="fa fa-camera"></i>&nbsp;Chọn ảnh đại diện</label>
            </div>
            <div class="w3-row w3-padding">
                <img id="avatar" src="../Content/avatar/<%=avatar%>" class="user-img-box" />
            </div>
            <div class="w3-row w3-padding">
                <a id="btn_edit_avatar_staff" class="w3-btn w3-white w3-border w3-border-black"><i class="fa fa-refresh"></i>&nbsp;Cập nhật</a>
                <a onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-btn w3-white w3-border w3-border-black"><i class="fa fa-times"></i>&nbsp;Hủy</a>
            </div>
        </div>
    </div>
    <div id="doianhbia" class="w3-modal">
        <div class="w3-modal-content w3-center w3-animate-top w3-card-8 w3-white">
            <header class="w3-padding">
                <p class="w3-xlarge">Cập nhật ảnh bìa</p>
            </header>
            <div class="w3-row w3-center">
                <input type="file" role="file" class="changewallpaper" name="fileUpload" id="changewallpaper" />
                <label for="changewallpaper" class="w3-btn w3-border w3-white"><i class="fa fa-camera"></i>&nbsp;Chọn ảnh bìa</label>
            </div>
            <div class="w3-row w3-padding">
                <img id="wallpaper" src="../Content/wallpaper/<%=banner %>" class="wallpaper-box" />
            </div>
            <div class="w3-row w3-padding">
                <a id="btn_edit_wall_staff" class="w3-btn w3-white w3-border w3-border-black"><i class="fa fa-refresh"></i>&nbsp;Cập nhật</a>
                <a onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-btn w3-white w3-border w3-border-black"><i class="fa fa-times"></i>&nbsp;Hủy</a>
            </div>
        </div>
    </div>

    <div id="del_notification" class="w3-modal">
        <div class="w3-modal-content w3-center w3-animate-top w3-card-8 w3-teal">
            <header class="w3-padding">
                <p id="del_notice" class="w3-hide"></p>
                <p class="w3-xlarge">Bạn có chắc chắn muốn xóa thông báo này?</p>
            </header>
            <div class="w3-row w3-padding">
                <a onclick="btn_accept_notice_del()" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-trash-o"></i>&nbsp;Xóa</a>
                <a onclick="this.parentElement.parentElement.parentElement.style.display='none'" class="w3-btn w3-teal w3-border w3-border-white"><i class="fa fa-times"></i>&nbsp;Hủy</a>
            </div>
        </div>
    </div>

    <div id="success-modal" class="w3-row w3-animate-right" style="position: fixed; right: 25px; bottom: 20%; display: none; z-index: 10">
        <div class="w3-teal w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
            <header class="w3-large"><i class="fa fa-check"></i>&nbsp;<span id="success_content"></span></header>
        </div>
    </div>
    <div id="error-modal" class="w3-row w3-animate-right" style="position: fixed; right: 25px; bottom: 20%; display: none; z-index: 10">
        <div class="w3-red w3-card-4 w3-center" style="padding: 20px; opacity: 0.9">
            <header class="w3-large"><i class="fa fa-times"></i>&nbsp;<span id="error_content"></span></header>
        </div>
    </div>
</asp:Content>
